/*****************************************************************************************
**  Author:jxx 2022
**  QQ:283591387
**完整文档见：http://v2.volcore.xyz/document/api 【代码生成页面ViewGrid】
**常用示例见：http://v2.volcore.xyz/document/vueDev
**后台操作见：http://v2.volcore.xyz/document/netCoreDev
*****************************************************************************************/
//此js文件是用来自定义扩展业务代码，可以扩展一些自定义页面或者重新配置生成的代码
import extendHeader from "@/views/finance/djlc/cw_djlc_configuration_tradition_upload.vue"
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: extendHeader,
    gridBody: '',
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  tableAction: 'cw_djlc_configuration_tradition', //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: { view: [], box: [], detail: [] }, //扩展的按钮
  methods: {
     //下面这些方法可以保留也可以删除
    onInit() {  //框架初始化配置前，
        //示例：在按钮的最前面添加一个按钮
        //   this.buttons.unshift({  //也可以用push或者splice方法来修改buttons数组
        //     name: '按钮', //按钮名称
        //     icon: 'el-icon-document', //按钮图标vue2版本见iview文档icon，vue3版本见element ui文档icon(注意不是element puls文档)
        //     type: 'primary', //按钮样式vue2版本见iview文档button，vue3版本见element ui文档button
        //     onClick: function () {
        //       this.$Message.success('点击了按钮');
        //     }
        //   });

        //示例：设置修改新建、编辑弹出框字段标签的长度
        // this.boxOptions.labelWidth = 150;
		
      //this.searchFormFields.cw_djlc_djzb_id = this.$store.getters.data().cw_djlc_djzb_id;
	  this.tableHeight = window.outerHeight*0.65;//只有放在onInit事件才有效果，放在onInited无效
      this.setFiexdSearchForm(true);
      this.singleSearch = null;
      if (this.$route.path!="/cw_djlc_configuration_tradition"){
        this.buttons.forEach(x => {
          if (x.name == "新 建" || x.name == "编 辑"||x.name == " 审核提交") {
            x.hidden = true;//vue3版本改为直接设置：x.hidden=true
          }
        })
      }
    },
    onInited() {
		this.$store.getters.data().cw_djlc_djzb_refresh = this;
      //框架初始化配置后
      //如果要配置明细表,在此方法操作
      //this.detailOptions.columns.forEach(column=>{ });
      this.columns.splice(0);
      this.columns.push(...[{field:'cw_djlc_configuration_tradition_id',title:'配置表id',type:'guid',sort:true,width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'cw_djlc_djzb_id',title:'定价主表id',type:'guid',width:110,hidden:true,require:true,align:'left'},
					   
					   {field:'name_ghpzx',title:'固化配置项',type:'string',width:220,align:'center',
					   children: [
						   {field:'serial_number',title:'序号',type:'string',width:220,align:'left',sort:true},
						   {field:'new_materialnum',title:'新车型号',type:'string',width:220,align:'left'},
						   {field:'brevity_code',title:'简码',type:'string',width:220,align:'left'},
						   {field:'announcement_type',title:'公告型号',type:'string',width:220,align:'left'},
						   {field:'vehicle_model',title:'车型',type:'string',width:220,align:'left'},
						   {field:'driving_form',title:'驱动形式',type:'string',width:220,align:'left'},
						   {field:'fuel_type',title:'燃料',type:'string',width:220,align:'left'},
						   {field:'allowed_total_weight',title:'允许车货总重',type:'string',width:220,align:'left'},
						   {field:'cage',title:'驾驶室',type:'string',width:220,align:'left'},
						   {field:'wheel_base',title:'轴距',type:'string',width:220,align:'left'},
						   {field:'applicable_jacket',title:'适用上装',type:'string',width:220,align:'left'},
						   {field:'car_frame',title:'车架',type:'string',width:220,align:'left'},
						   {field:'suspension_type',title:'悬架型式',type:'string',width:220,align:'left'},
						   {field:'ct_engine_series',title:'发动机系列',type:'string',width:220,align:'left'},
					   ]
					   },
					   {field:'name_sckxx',title:'市场可选项',type:'string',width:220,align:'center',
					   children: [
						   {field:'ct_engine_type',title:'发动机型号',type:'string',width:220,align:'left'},
						   
						   {field:'ct_intake_heating',title:'进气加热',type:'string',width:220,align:'left'},
						   {field:'fuel_tank',title:'燃料箱',type:'string',width:220,align:'left'},
						   {field:'brake_type',title:'制动型式',type:'string',width:220,align:'left'},
						   {field:'plate_spring_number',title:'板簧片数',type:'string',width:220,align:'left'},
						   {field:'speed_ratio',title:'速比',type:'string',width:220,align:'left'},
						   {field:'tyre',title:'轮胎',type:'string',width:220,align:'left'},
						   {field:'rim',title:'轮辋',type:'string',width:220,align:'left'},
						   {field:'seat',title:'座椅',type:'string',width:220,align:'left'},
						   {field:'fairing',title:'导流罩',type:'string',width:220,align:'left'},
						   {field:'fender_rear_wheel',title:'后轮上挡泥板',type:'string',width:220,align:'left'},
						   {field:'tire_pressure_monitoring',title:'胎压监测',type:'string',width:220,align:'left'},
						   {field:'inverter',title:'逆变器',type:'string',width:220,align:'left'},
						   {field:'car_mounted_multimedia',title:'车载多媒体',type:'string',width:220,align:'left'},
						   {field:'video_assistance_system',title:'视频辅助系统',type:'string',width:220,align:'left'},
						   {field:'battery_capacity',title:'蓄电池容量',type:'string',width:220,align:'left'},
						   {field:'ct_parking_air_conditioner',title:'驻车空调',type:'string',width:220,align:'left'},
						   {field:'ct_independent_heater',title:'独立加热器',type:'string',width:220,align:'left'},
						   {field:'car_refrigerator',title:'车载冰箱',type:'string',width:220,align:'left'},
						   {field:'ct_retarder',title:'缓速器',type:'string',width:220,align:'left'},
						   {field:'saddle',title:'鞍座',type:'string',width:220,align:'left'},
					   ]
					   },
					   {field:'name_jspzx',title:'技术配置项',type:'string',width:220,align:'center',
					   children: [
						   {field:'constant_cruising',title:'定速巡航',type:'string',width:220,align:'left'},
						   {field:'ct_in_cylinder_braking',title:'缸内制动',type:'string',width:220,align:'left'},
						   {field:'ct_remote_throttle',title:'远程油门',type:'string',width:220,align:'left'},
						   {field:'maximum_speed_limit',title:'最高车速限制',type:'string',width:220,align:'left'},
						   {field:'ct_fan_clutch',title:'风扇离合器',type:'string',width:220,align:'left'},
						   {field:'ct_fuel_preliminary_filter',title:'燃油粗滤器',type:'string',width:220,align:'left'},
						   {field:'ct_air_filter',title:'空滤器',type:'string',width:220,align:'left'},
						   {field:'fan_lower_baffle',title:'风扇下挡板',type:'string',width:220,align:'left'},
						   {field:'ct_clutch',title:'离合器',type:'string',width:220,align:'left'},
						   
						   {field:'steering_engine',title:'转向机',type:'string',width:220,align:'left'},
						   
						   {field:'transmission_model',title:'变速器型号',type:'string',width:220,align:'left'},
						   {field:'transmission_take_up',title:'变速器取力器',type:'string',width:220,align:'left'},
						   {field:'ct_variable_speed_control_mode',title:'变速操纵型式',type:'string',width:220,align:'left'},
						   {field:'mandrel_form',title:'芯轴形式',type:'string',width:220,align:'left'},
						   {field:'thrust_rod_type',title:'推力杆型式',type:'string',width:220,align:'left'},
						   {field:'front_crosswise_bar',title:'前横向稳定杆',type:'string',width:220,align:'left'},
						   {field:'front_axle_specification',title:'前桥规格',type:'string',width:220,align:'left'},
						   {field:'front_alxe_free_preserve',title:'前桥免维护',type:'string',width:220,align:'left'},
						   {field:'back_alxe_model',title:'后桥型号',type:'string',width:220,align:'left'},
						   {field:'back_alxe_free_preserve',title:'后桥免维护',type:'string',width:220,align:'left'},
						   {field:'interwheel_differential_lock',title:'轮间差速锁',type:'string',width:220,align:'left'},
						   {field:'interaxial_differential_lock',title:'轴间差速锁',type:'string',width:220,align:'left'},
						   {field:'steering_wheel_guide_pattern',title:'转向轮导向花纹',type:'string',width:220,align:'left'},
						   {field:'front_wheel_blowout_device',title:'前轮爆胎应急装置',type:'string',width:220,align:'left'},
						   {field:'electronic_brake_type',title:'电子制动型式',type:'string',width:220,align:'left'},
						   {field:'electronic_brake_modle',title:'电子制动品牌',type:'string',width:220,align:'left'},
						   {field:'cab_suspension',title:'驾驶室悬置',type:'string',width:220,align:'left'},
						   {field:'front_bumper',title:'前保险杠',type:'string',width:220,align:'left'},
						   {field:'front_mask_color',title:'前面罩颜色',type:'string',width:220,align:'left'},
						   {field:'fender',title:'挡泥板',type:'string',width:220,align:'left'},
						   {field:'skylight',title:'天窗',type:'string',width:220,align:'left'},
						   {field:'upper_berth',title:'上卧铺',type:'string',width:220,align:'left'},
						   {field:'door_lower_fascia',title:'车门下饰板',type:'string',width:220,align:'left'},
						   {field:'door_lock',title:'门锁',type:'string',width:220,align:'left'},
						   {field:'air_conditioner',title:'空调',type:'string',width:220,align:'left'},
						   {field:'steering_wheel',title:'方向盘',type:'string',width:220,align:'left'},
						   {field:'daytime_running_light',title:'日间行车灯',type:'string',width:220,align:'left'},
						   {field:'back_assembly_light_model',title:'后组合灯型式',type:'string',width:220,align:'left'},
						   {field:'power_controller',title:'电源控制器',type:'string',width:220,align:'left'},
						   {field:'ct_joint_pass',title:'远程车载终端',type:'string',width:220,align:'left'},
						   {field:'auxiliary_safety_system',title:'辅助安全系统',type:'string',width:220,align:'left'},
						   {field:'battery_type',title:'蓄电池类型',type:'string',width:220,align:'left'},
						   {field:'battery_tray_type',title:'蓄电池托盘型式',type:'string',width:220,align:'left'},
					   ]
					   },
                       {field:'name_gjbzx',title:'关键布置项目',type:'string',width:220,align:'center',
					   children: [
						   {field:'ct_air_filter_arrangement',title:'空滤布置',type:'string',width:220,align:'left'},
						   {field:'ct_silencer_arrangement',title:'消声器布置',type:'string',width:220,align:'left'},
						   {field:'ct_urea_tank_layout',title:'尿素罐布置',type:'string',width:220,align:'left'},
						   {field:'ct_fuel_tank_layout',title:'燃料箱布置',type:'string',width:220,align:'left'},
						   {field:'ct_battery_arrangement',title:'蓄电池布置',type:'string',width:220,align:'left'},
					   ]
					   },
					   {field:'name_qt',title:'其他',type:'string',width:220,align:'center',
					   children: [
						   {field:'ct_design_quality',title:'设计质量（kg）',type:'string',width:220,align:'left'},
						   {field:'ct_remark',title:'备注',type:'string',width:220,align:'left'},
                       ]
					   },
                      
              {field:'Creator',title:'创建人',type:'string',width:100,hidden:true,align:'left'},
              {field:'CreateDate',title:'创建时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
              {field:'Modifier',title:'修改人',type:'string',width:100,hidden:true,align:'left'},
              {field:'ModifyDate',title:'修改时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
              {field:'type',title:'1传统车 2新能源车',type:'string',width:110,hidden:true,align:'left'},
              {field:'del_flag',title:'1删除0未删除',type:'string',width:110,hidden:true,align:'left'}]

)
    },
    searchBefore(param) {
      //界面查询前,可以给param.wheres添加查询参数
      //返回false，则不会执行查询
      let wheres = [{
        'name':'del_flag',
        'value':0
      },{
        'name':'cw_djlc_djzb_id',
        'value':this.$store.getters.data().cw_djlc_djzb_id
      }]
      param.wheres.push(...wheres);
      return true;
    },
    searchAfter(result) {
      //查询后，result返回的查询数据,可以在显示到表格前处理表格的值
      return true;
    },
    addBefore(formData) {
      //新建保存前formData为对象，包括明细表，可以给给表单设置值，自己输出看formData的值
      return true;
    },
    updateBefore(formData) {
      //编辑保存前formData为对象，包括明细表、删除行的Id
      return true;
    },
    rowClick({ row, column, event }) {
      //查询界面点击行事件
       this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
    },
    modelOpenAfter(row) {
      //点击编辑、新建按钮弹出框后，可以在此处写逻辑，如，从后台获取数据
      //(1)判断是编辑还是新建操作： this.currentAction=='Add';
      //(2)给弹出框设置默认值
      //(3)this.editFormFields.字段='xxx';
      //如果需要给下拉框设置默认值，请遍历this.editFormOptions找到字段配置对应data属性的key值
      //看不懂就把输出看：console.log(this.editFormOptions)
    },
    import() {//覆盖导入事件
      //this.$refs.gridHeader.model = true;
      this.$refs.gridHeader.openModel();
    },
	exportBefore(param) {
		let wheres = [{
			'name':'del_flag',
			'value':0
		  },{
			'name':'cw_djlc_djzb_id',
			'value':this.$store.getters.data().cw_djlc_djzb_id
		  }]
		  param.wheres.push(...wheres);
		  return true;
	}
  }
};
export default extension;
